


#ifndef PF_FONT_H
#define PF_FONT_H

#include <iostream>
#include <QStringList>
#include "pf_blocklist.h"
#include "lx_Export.h"

/**
 * Class for representing a font. This is implemented as a PF_Graphic
 * with a name (the font name) and several blocks, one for each letter
 * in the font.
 *

 */
class LX_EXPORT PF_Font {
public:
    PF_Font(const QString& name, bool owner=true);
    //PF_Font(const char* name);

    /** @return the fileName of this font. */
    QString getFileName() const {
        return fileName;
    }
	
    /** @return the encoding of this font. */
    QString getEncoding() const {
        return encoding;
    }
	
    /** @return the alternative names of this font. */
    const QStringList& getNames() const {
        return names;
    }
	
    /** @return the author(s) of this font. */
    const QStringList& getAuthors() const {
        return authors;
    }

    /** @return Default letter spacing for this font */
    double getLetterSpacing() {
        return letterSpacing;
    }

    /** @return Default word spacing for this font */
    double getWordSpacing() {
        return wordSpacing;
    }

    /** @return Default line spacing factor for this font */
    double getLineSpacingFactor() {
        return lineSpacingFactor;
    }

    bool loadFont();

	// Wrappers for block list (letters) functions
	PF_BlockList* getLetterList() {
		return &letterList;
	}
    PF_Block* findLetter(const QString& name) {
		return letterList.find(name);
	}
    uint countLetters() {
        return letterList.count();
    }
    PF_Block* letterAt(uint i) {
		return letterList.at(i);
	}

    friend std::ostream& operator << (std::ostream& os, const PF_Font& l);

    friend class PF_FontList;

private:
	//! block list (letters)
	PF_BlockList letterList;

    //! Font file name
    QString fileName;
	
    //! Font encoding (see docu for QTextCodec)
    QString encoding;

	//! Font names
        QStringList names;
	
	//! Authors
        QStringList authors;

    //! Is this font currently loaded into memory?
    bool loaded;

    //! Default letter spacing for this font
    double letterSpacing;

    //! Default word spacing for this font
    double wordSpacing;

    //! Default line spacing factor for this font
    double lineSpacingFactor;
};

#endif

